function MainMenu(){
    Sprite.apply(this);
    Menu.apply(this);
    const MARGIN = 10;
    this.buttons = new Array();
    this.buttons["start"] =new Button("Start Game");
    this.buttons["select"] = new Button("Select level");
    this.buttons["share"] = new Button("Share Game");
    this.buttons["exit"] = new Button("Exit Game");
                
    this.functions = new Array();
    this.functions["start"] = function(e){
        alert("start");
    }
                
    this.functions["select"] = function(e){
        alert("select");
    }
                
    this.functions["share"] = function(e){
        alert("share");
    }
                
    this.functions["exit"] = function(e){
        alert("exit");
    }
                
                
    var i = 0;
    for (var key in this.buttons) {
        var count = 4;//this.buttons.length;
        console.debug(count);
        var height = this.buttons[key].height + MARGIN;
        var baseY = cheight/2 - (count*(height))/2;
        this.buttons[key].x = cwidth/2 - this.buttons[key].width/2;
        this.buttons[key].y = baseY + i*height;
                    
        this.buttons[key].addEventListener(MouseEvent.CLICK,this.functions[key]);
                    
        this.addChild(this.buttons[key]);
        i++;
    }
                
}
MainMenu.prototype = new Sprite();